<template>
  <div class="index">
    <!-- Index组件内的二级路由对应组件的渲染出口 -->
    <transition mode="out-in">
      <!-- <keep-alive> -->
        <router-view></router-view>
      <!-- </keep-alive> -->
    </transition>

    <van-tabbar v-model="active" route>
      <van-tabbar-item icon="home-o" to="/index/home">首页</van-tabbar-item>
      <van-tabbar-item icon="search" to="/index/tuan">爆爆团</van-tabbar-item>
      <van-tabbar-item icon="friends-o" to="/index/order">订单</van-tabbar-item>
      <van-tabbar-item icon="setting-o" to="/index/mine">我的</van-tabbar-item>
    </van-tabbar>

  </div>
</template>

<script>
export default {
  data(){
    return {
      active:0
    }
  },
  methods:{
    toHome(){
      if( 1 == 2 ){
        this.$router.push({name:'home', params:{id:888,name:''} });
      }else{
        this.$router.push({name:'order', params:{id:888,name:''} });
      }
    }
  }
}
</script>

<style lang="scss">
.tabbar{
  display: flex;
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  justify-content: space-around;
  align-items: center;
  background-color: white;
  border-top: 1px solid #ccc;
  a.router-link-active{
    color: red;
  }
}
.v-enter{
  opacity: 0;
}
.v-enter-active{
  transition: all 0.2s;
}
.v-enter-to{
  opacity: 1;
}
.v-leave{
  opacity: 1;
}
.v-leave-active{
  transition: all 0.2s;
}
.v-leave-to{
  opacity: 0;
}
</style>